/**  
 * Copyright (c) 2010 University of Pennsylvania.
 *     All rights reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an "AS
 *  IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 *  express or implied.  See the License for the specific language
 *  governing permissions and limitations under the License.
 *
 */
 
#define CONGFACTOR_BASE           10
#define CONG_FACTOR(level)        (CONGFACTOR_BASE+4/(2*(level)+1))
#define PATHVEC_OVERHEAD(length)  (DIV_CEIL(ADDR_BITS*(length), 8))

#define LINK_OVERHEAD       4
#define CONFIRM_OVERHEAD    5
#define FORWARD_OVERHEAD    4   // for equality with old cost model this needs to be 5
#define TUPLE_OVERHEAD      5

uint32_t estimate_singlejoincost(uint8_t is_base, int path_len, uint8_t *path_levels,
  uint8_t pathlevel_reverse, uint8_t source_level, uint8_t join_level, uint8_t join_multiplicity,
  uint8_t rel_id, uint8_t *sel, uint8_t *width, uint8_t ws, uint8_t multicast_overhead);
uint32_t estimate_paircost(uint8_t *joinsource_levels, int joinsource_pathlen,
  uint8_t *targetjoin_levels, int targetjoin_pathlen, uint8_t is_base, uint8_t rel_id, uint8_t *sel,
  uint8_t *width, uint8_t ws);
uint32_t estimate_multicastcost(MULTICAST_NODE *n, uint8_t is_cached, uint8_t rel_id, uint8_t *sel,
  uint8_t *width, uint8_t ws, uint8_t level);


